package com.khadi.testcase.view.editor;

import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellEditor;

public class TextEditor extends AbstractCellEditor implements TableCellEditor {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6153425491319666467L;

	private Object value;
	private JTextField tfTextField = new JTextField();;

	@Override
	public Object getCellEditorValue() {
		return tfTextField.getText();
	}

	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean isSelected, int row, int column) {
		this.value = value;
		
		tfTextField.setText((String) this.value);

		return tfTextField;
	}
}
